#include "selectusr.h"
#include "ui_selectusr.h"
#include <QDebug>

SelectUsr::SelectUsr(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SelectUsr)
{
    ui->setupUi(this);
    this->setFixedSize(this->size().width(),this->size().height());
    this->setWindowIcon(QIcon(":/new/prefix1/Image/mesage.png"));
    QPalette qp = this->palette(); //重新拷贝一份和本对象palette相同的palette
    qp.setBrush(QPalette::Window,QBrush(QImage(":/new/prefix1/Image/Frame.jpg").scaled(this->size())));
    this->setPalette(qp);

    this->setWindowTitle("USR INFO");

    this->ui->pic->setPixmap(QPixmap(":/new/prefix1/Image/write2file.png"));

    connect(this,&SelectUsr::my_select_signal,this,&SelectUsr::my_select_slot);
}

SelectUsr::~SelectUsr()
{
    delete ui;
}

void SelectUsr::my_select_slot(QStringList strlist)
{
    this->ui->textEdit->clear();
    this->ui->textEdit->setReadOnly(true);
    int i = 1;
    QString temp;
    for(QString str : strlist)
    {
        if(i % 4 != 0)
        temp += str;
        if(i % 4 == 0)
        {
            this->ui->textEdit->append(temp);
            temp.clear();
        }
        else if(i %4 != 0)
        {
            temp += " ; ";
        }
        i++;
    }
}

void SelectUsr::on_back_btn_clicked()
{
    emit this->my_back_to_managerop_signal();
    this->hide();
    this->ui->textEdit->clear();
}
